import request from "@/utils/request"

export enum BigCarStatus {
  启用 = 1,
  禁用 = 2,
}
export interface QueryBigCarListParams extends PaginationParams {
  carPlat?: string
  status?: BigCarStatus
  vin?: string
}

export interface BigCar {
  /** 车牌号 */
  carPlat: number
  /** 公司 ID */
  companyId: string
  /** 创建时间 */
  createTime: string
  /** 车辆编号 */
  id: number
  /** 别名 */
  infoName: string
  /** 状态 */
  status: BigCarStatus
  vin: string
}

export async function queryChargeList(params: QueryBigCarListParams) {
  return request<BigCar[]>('/app/manager/bigCompany/car/list', {
    data: params, token: localStorage.Authorization2
  })
}

export async function upStatus(params: {
  companyCarId: number
  status: 1 | 2 | 3, // 1 启用，2 禁用，3 删除
}) {
  return request('/app/manager/bigCompany/car/upStatus', {
    data: params, token: localStorage.Authorization2
  })
}

export async function addOrUp(params: BigCar) {
  return request('/app/manager/bigCompany/car/addOrUp', {
    data: params, token: localStorage.Authorization2
  })
}
